package com.longtxt.core.ble.main;

import android.bluetooth.BluetoothGatt;

import androidx.annotation.NonNull;

import java.lang.reflect.Method;

import timber.log.Timber;

public class GattUtil {
    /** @noinspection JavaReflectionMemberAccess*/
    public static void clearGattCache(@NonNull BluetoothGatt gatt) {
        try {
            Method localMethod = gatt.getClass().getMethod("refresh");
            localMethod.invoke(gatt);
            Timber.tag("GattUtil").e("Gatt cache cleared");
        } catch (Exception e) {
            Timber.tag("GattUtil").e("clear failed");
        }
    }
}
